import {reqGetTrade, reqSubmitOrder} from "@/api";

const state = {
    tradeInfo: {},

}
const mutations = {
    RECEIVE_TRADEINFO(state, tradeInfo) {
        state.tradeInfo=tradeInfo
    },
}
const actions = {
  async  getTrade({commit}){
        const result =await reqGetTrade()
      if (result.code===200){
          commit('RECEIVE_TRADEINFO',result.data)
          return 'ok'
      }else {
          return Promise.reject(new Error('failed'))
      }
    },

}
const getters = {
    detailArrayList(state){
        return state.tradeInfo.detailArrayList||[]
    }
}
export default {
    state,
    mutations,
    actions,
    getters
}